Optimal. Leaf size=59 \[ -\frac {\left (a^2+2 b^2\right ) \tanh ^{-1}(\cos (e+f x))}{2 f}-\frac {2 a b \cot (e+f x)}{f}-\frac {a^2 \cot (e+f x) \csc (e+f x)}{2 f} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.06, antiderivative size = 59, normalized size of antiderivative = 1.00, number of steps
used = 5, number of rules used = 5, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.238, Rules used = {2868, 3852, 8,
3091, 3855} \begin {gather*} -\frac {\left (a^2+2 b^2\right ) \tanh ^{-1}(\cos (e+f x))}{2 f}-\frac {a^2 \cot (e+f x) \csc (e+f x)}{2 f}-\frac {2 a b \cot (e+f x)}{f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 2868
Rule 3091
Rule 3852
Rule 3855
Rubi steps
\begin {align*} \int \csc ^3(e+f x) (a+b \sin (e+f x))^2 \, dx &=(2 a b) \int \csc ^2(e+f x) \, dx+\int \csc ^3(e+f x) \left (a^2+b^2 \sin ^2(e+f x)\right ) \, dx\\ &=-\frac {a^2 \cot (e+f x) \csc (e+f x)}{2 f}+\frac {1}{2} \left (a^2+2 b^2\right ) \int \csc (e+f x) \, dx-\frac {(2 a b) \text {Subst}(\int 1 \, dx,x,\cot (e+f x))}{f}\\ &=-\frac {\left (a^2+2 b^2\right ) \tanh ^{-1}(\cos (e+f x))}{2 f}-\frac {2 a b \cot (e+f x)}{f}-\frac {a^2 \cot (e+f x) \csc (e+f x)}{2 f}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(133\) vs. \(2(59)=118\).
time = 0.30, size = 133, normalized size = 2.25 \begin {gather*} \frac {-8 a b \cot \left (\frac {1}{2} (e+f x)\right )-a^2 \csc ^2\left (\frac {1}{2} (e+f x)\right )-4 a^2 \log \left (\cos \left (\frac {1}{2} (e+f x)\right )\right )-8 b^2 \log \left (\cos \left (\frac {1}{2} (e+f x)\right )\right )+4 a^2 \log \left (\sin \left (\frac {1}{2} (e+f x)\right )\right )+8 b^2 \log \left (\sin \left (\frac {1}{2} (e+f x)\right )\right )+a^2 \sec ^2\left (\frac {1}{2} (e+f x)\right )+8 a b \tan \left (\frac {1}{2} (e+f x)\right )}{8 f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.34, size = 73, normalized size = 1.24
method | result | size |
derivativedivides | \(\frac {a^{2} \left (-\frac {\csc \left (f x +e \right ) \cot \left (f x +e \right )}{2}+\frac {\ln \left (\csc \left (f x +e \right )-\cot \left (f x +e \right )\right )}{2}\right )-2 a b \cot \left (f x +e \right )+b^{2} \ln \left (\csc \left (f x +e \right )-\cot \left (f x +e \right )\right )}{f}\) | \(73\) |
default | \(\frac {a^{2} \left (-\frac {\csc \left (f x +e \right ) \cot \left (f x +e \right )}{2}+\frac {\ln \left (\csc \left (f x +e \right )-\cot \left (f x +e \right )\right )}{2}\right )-2 a b \cot \left (f x +e \right )+b^{2} \ln \left (\csc \left (f x +e \right )-\cot \left (f x +e \right )\right )}{f}\) | \(73\) |
risch | \(-\frac {i a \left (i a \,{\mathrm e}^{3 i \left (f x +e \right )}+i a \,{\mathrm e}^{i \left (f x +e \right )}+4 b \,{\mathrm e}^{2 i \left (f x +e \right )}-4 b \right )}{f \left ({\mathrm e}^{2 i \left (f x +e \right )}-1\right )^{2}}-\frac {a^{2} \ln \left ({\mathrm e}^{i \left (f x +e \right )}+1\right )}{2 f}-\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+1\right ) b^{2}}{f}+\frac {a^{2} \ln \left ({\mathrm e}^{i \left (f x +e \right )}-1\right )}{2 f}+\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}-1\right ) b^{2}}{f}\) | \(143\) |
norman | \(\frac {\frac {a b \left (\tan ^{5}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f}+\frac {a b \left (\tan ^{7}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f}-\frac {a^{2}}{8 f}+\frac {a^{2} \left (\tan ^{8}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{8 f}-\frac {a^{2} \left (\tan ^{4}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{2 f}-\frac {a^{2} \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{2 f}-\frac {a b \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{f}-\frac {a b \left (\tan ^{3}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f}}{\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2} \left (1+\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )^{2}}+\frac {\left (a^{2}+2 b^{2}\right ) \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{2 f}\) | \(187\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.28, size = 96, normalized size = 1.63 \begin {gather*} \frac {a^{2} {\left (\frac {2 \, \cos \left (f x + e\right )}{\cos \left (f x + e\right )^{2} - 1} - \log \left (\cos \left (f x + e\right ) + 1\right ) + \log \left (\cos \left (f x + e\right ) - 1\right )\right )} - 2 \, b^{2} {\left (\log \left (\cos \left (f x + e\right ) + 1\right ) - \log \left (\cos \left (f x + e\right ) - 1\right )\right )} - \frac {8 \, a b}{\tan \left (f x + e\right )}}{4 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 137 vs.
\(2 (59) = 118\).
time = 0.36, size = 137, normalized size = 2.32 \begin {gather*} \frac {8 \, a b \cos \left (f x + e\right ) \sin \left (f x + e\right ) + 2 \, a^{2} \cos \left (f x + e\right ) - {\left ({\left (a^{2} + 2 \, b^{2}\right )} \cos \left (f x + e\right )^{2} - a^{2} - 2 \, b^{2}\right )} \log \left (\frac {1}{2} \, \cos \left (f x + e\right ) + \frac {1}{2}\right ) + {\left ({\left (a^{2} + 2 \, b^{2}\right )} \cos \left (f x + e\right )^{2} - a^{2} - 2 \, b^{2}\right )} \log \left (-\frac {1}{2} \, \cos \left (f x + e\right ) + \frac {1}{2}\right )}{4 \, {\left (f \cos \left (f x + e\right )^{2} - f\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (a + b \sin {\left (e + f x \right )}\right )^{2} \csc ^{3}{\left (e + f x \right )}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 125 vs.
\(2 (59) = 118\).
time = 0.45, size = 125, normalized size = 2.12 \begin {gather*} \frac {a^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 8 \, a b \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 4 \, {\left (a^{2} + 2 \, b^{2}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) \right |}\right ) - \frac {6 \, a^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 12 \, b^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 8 \, a b \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + a^{2}}{\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2}}}{8 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 6.49, size = 92, normalized size = 1.56 \begin {gather*} \frac {a^2\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2}{8\,f}+\frac {\ln \left (\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )\right )\,\left (\frac {a^2}{2}+b^2\right )}{f}-\frac {{\mathrm {cot}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2\,\left (\frac {a^2}{8}+b\,\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )\,a\right )}{f}+\frac {a\,b\,\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}{f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________